home *** CD-ROM | disk | FTP | other *** search
- Monday 21-Sep-92 15:20:38
-
- AXSH(1) USER COMMANDS Version 1.26
-
-
- NAME
- AXsh - a shell (command interpreter)
-
- SYNOPSIS
- AXsh
-
- DESCRIPTION
- AXsh, the AXshell, is a command interpreter with a number of
- convenient features for interactive use that are or are not
- available with the standard AmigaDOS shell, including command
- aliasing,history events, variables, filename and command name
- completion , shell level protections and a number of built-in
- commands.
-
- OPTIONS
- -con Turn off carrier checking (console mode)
-
- -log Keep log (AXsh:etc/adm/log.*)
-
- -user <user>
- Accepts user without asking the password. Account for
- the user must still exist in /etc/passwd. In this
- mode "login" command causes relogin with the same
- login name. This option is useful with closed UUCP
- systems.
-
-
- Command Line Editing
- The command line editor has two modes depending on the 'term'
- environmental variable (vt100 or ANSI). In ANSI-mode it sends
- more bytes, so vt100-mode is recommended.
-
- The editor knows about these commands:
-
- left/right ^B/^F Moves cursor left and right
- up/down ^P/^N Recalls history events
- Shift-left ^A Goto the start of line
- Shift-right ^E Goto the end of line
- Shift-up Try history completion
- Backspace Delete previous character
- Delete (^D) Delete current (next) character
- ^L, ^R Refresh line
- ^K Delete to the end of line
- ^U Delete to the start of line
- ^W Delete previous word
- ^X Delete line
-
- TAB (^I) Try command/filename completion
- Return/Newline (^J/^M) End editing :-)
-
- HELP String assigned in variable HELP
- F1 String in variable F1
- : :
- : :
- F20 String in variable F20
-
- Command Line Parsing
- A simple command is composed of a sequence of words. The
- first word specifies the command to be executed. One line can
- have several commands separated with a semicolon (";").
-
- Variable substitution
- In case '$' is encountered, it is treated as an environmental
- variable and the variable is replaced by its value. If the
- variable is to be part of a word, it must be surrounded by
- braces of some kind. The substitution is not done inside the
- quotes . List of the reserved and special variables may be
- found elsewhere in this document.
-
- $name Normal type, will (usually) select the whole
- variable as is.
- $name[select] Selects only one word from the variable.
- Numbering starts from zero. If the referenced
- word doesn't exist,a NULL string is returned.
- ${name}[select] When the variable name contains spaces or '['
- chars , it must be surrounded by braces. Any
- pair of "()", "[]" and "{}" are considered as
- braces.
- examples:
-
- > echo $user
- root
- > echo ${tty}/$[host] $(quota)kB
- con7/amiga.pasbox.fi 30kB
-
- > echo ${s p a c e}
-
- You can still use $-sign by doubling it ($$->$). Another way
- to use $-sign is to preceed it with a back-slash (\).
-
- There is a special variable: $< , which reads a line from the
- standard input and that line is appended to the command line
- as is.
-
- Each variable is inserted as a single argument, even if it
- consists of several words. If you want to add something to the
- same argument, you can use e.g.
-
- $[var1]" text "$var2 "a"\"$[var]\""b"
-
- Command Separator
- If you want to execute several commands from a single line
- you can use ';' as a delimiter. This command separator works
- only with command line, not from scripts.
-
- In script files semicolon is used as a comment-mark!
-
- e.g. "cd arc: ; ls"
-
- If you want to use semicolon on its own, preceed it with a
- backslash: "\;". The same applies to every special character.
-
- e.g. "echo ls \; more file\ name ; ls ; more file\ name"
-
- History Events
- History events allows you to call for already typed lines for
- editing. You can use either cursor keys up/down or type the
- !-character and the command number. History numbers can be
- found out with the 'history'-command,which is built in the
- getline-routine. The number of history-lines is fixed and
- cannot be set by user.
-
- Command, history, directory and filename completion
- The command line editor offers you the ability to complete a
- partial filename by pressing TAB (^I). If the name matches
- several files or directories, expansion is made only to the
- extent it can be made and a BELL (^G) is printed.
-
- If you apply TAB (^I) to the first word on a line,the word is
- treated as a command and the completion is made accordingly.
- If no perfect match was found on the command set , a filename
- completion is tried. Remember that these actions are separate,
- and a partial completion may be performed in the ccomp
- routine before passing the partial filename to fcomp. You
- can do completions on redirections too.
-
- History completions are also possible. This function can be
- invoked using shift+crsr up. It behaves like fcomp and beeps
- for a partial completion.
-
- Aliases
- The AX shell maintains a list of aliases that you can create,
- display and modify using the alias and unalias commands. The
- shell checks the beginning of each command line to see if it
- matches a name of an existing alias. If it does, the command
- is reprocessed with the alias definition replacing its name.
-
- Aliases shouldn't be nested . An alias definition shouldn't
- contain another alias as the first command, because the alias
- substitution is made only once for each command. So,recursive
- aliases are not possible , but looping aliases are easy to
- create. To break such loop, you may have to send successive
- BREAKs (^C) for undefined period of time (depending on the
- command inside the loop).
- (ex. alias loop wait 10\;loop)
-
- You cannot make an alias for strings 'alias' or 'unalias', so
- these commands are always accessible.
-
- Aliases are case-sensitive, so you can escape an alias by
- typing the command using a different case.
-
- I/O Redirection
- The following metachars indicate that the subsequent word is
- the name of a file to which the command's standard output is
- redirected. Standard input cannot yet be redirected.
- Redirection does not work with all of the shell builtins.
-
- > Redirect the standard output to a file . If the file
- does not exist, it is created. If it does exist,it is
- overwritten; its previous contents are lost.
-
- >> Append the standard output. Like >, but places output
- at the end of the file rather than overwriting it. If
- the file does not to exist, it is created.
-
- | Simple piping. Everything after the pipe symbol in the
- command line is considered to be another command. The
- piping uses temporary files created in T:.
-
- Redirection and piping can't be used simultaneously !
-
- Command Execution
- If the command is a AXshell built-in, the shell executes it
- directly. Otherwise, the shell searches for a file by that
- name with execute permission. If the command-name contains a
- / or a : the shell takes it as a pathname, but completely
- ignores it. This way unsecure commands won't be executed. You
- can also use this feature to supress alias-replacement.
-
- e.g. c:dir would use the command 'dir', not the alias for dir
-
- For superusers in local (console) mode things are not as
- simple. Paths are used as is.
-
- Signal Handling
- The AXshell normally ignores all signals. Ctrl-D is checked
- only if the ignoreeof-variable it SET. Ctrl-C it not yet used
- for anything . It is upto the running program to acknowledge
- break signals. AXsh will exit if it detects an EOF situation
- or a loss of carrier. If you open AXsh in a window with a
- close-gadget, it can also be used to make AXsh exit.
-
- Directory and filename expansion
- The shell expands all arguments containing ':' or '/' chars.
- This way all external commands get the right parameters and
- you still have a consistent referencing in filesystem: you
- can use '~/' to refer to home dir in any command.
-
- This expansion can be turned off by defining the 'f'-flag for
- the command in AXsh:etc/rc. This means that the argument is
- not a filename.
-
- Wildcard expansion isn't made by AXsh,but the command itself,
- if it supports wildcards. This may change in the future.
-
- Built-In Commands
- Built-in commands are executed within the AXshell.
-
- ; Null command.This command is interpreted,but performs
- no action. Actually this contains two null-commands.
- In script files semicolon is used as a comment mark.
-
- alias [ name [ def ] ]
- Assign "def" to the alias name. "name" is not allowed
- to be "alias" or "unalias" . If def is omitted , the
- alias name is displayed along with its current
- definition. If both the name and def are omitted, all
- aliases are displayed. The name is the first argument
- and the definition is the second.
-
- e.g. alias help "man axsh"
-
- You can remove all aliases with "alias clear".
-
- cd [ dir ]
- Change the shell's working directory to directory
- dir. If no argument is given, change to the home
- directory of the user. ~ denotes home directory and :
- denotes the root directory of the current working
- directory. '..' is the parent directory and / is the
- AXsh: assign or disk.
-
- "cd" may be omitted , if there is no command mathing
- the directory name.
-
- echo Just prints out everything to the output. Mainly used
- on script files for output. The trailing newline is
- not printed if the first argument is "-n" or the last
- argument is "noline".
-
- Example: echo $realname has logged on $host
-
- execute script-file
- Get the commands from a specified file. The execution
- continues until the end of file is reached or if an
- error occurs. Empty lines are skipped. Scripts can be
- nested, but the recursion depth is limited.
-
- Since 1.3 you can also redirect the output of a script.
-
- "execute" may be omitted, if there is no command with
- the same name as the script-file nor a directory with
- the same name (currently this is impossible in Amiga).
- "execute" still appears as the zeroth argument to the
- script. The script file bit must also be set if you
- plan to start the script with only its name !
-
- exit The shell exits and hangs up, if remote connection.
-
- ftp file [file2 ..]
- Will copy the file(s) to the home directory.
-
- internal
- Lists all internal commands. It is still possible that
- they aren't allowed to all users, depending on /etc/rc.
-
- login Terminate a login and initiate a new one.
-
- protect modes file [file2 ..]
- Parses the mode argument and then sets the protection
- bits accordingly. You can set, clear and toggle ANY
- defined bit, including group and world protection
- bits.
-
- e.g. protect go+r-w /etc/systemaliases
-
- However, THESE BITS ARE NOT USED in AXsh yet, but ls
- shows them.
-
- quit A null-command. Otherwise used to exit scripts.
-
- quota Shows home filesystem , number of files used , disk
- space used and usage limit. Will return warning level
- (5) if the quota is exceeded.
-
- set [ var [ definition ] ]
- Create or modify a shell variable. There are several
- predefined ones that cannot be changed and some, with
- whom the changes are discarded. Actually all variables
- are currently environmental variables, but this is
- supposed to change.
-
- The variable name is the first argument and the
- definition is the second.
-
- From version 1.3 all AXsh variables are exported to 2.0
- shell local variables. You also have a list of WORM-
- variables that can only be set once (/etc/ForbiddenVars).
-
- e.g. set HELP "cat /etc/motd\n"
-
- -- System variables:
-
- user user's login name
- tty which terminal 'line' the user uses
- accesslevel just what it says.
- realname full name of the user
- home user's home directory
- host current host name
- dosv system version
- intime time the user has been logged in (mins)
-
- -- Special variables:
- autologout in minutes - time between keystrokes
- in AXsh for automatic logout.
-
- language What catalog to use. If the language
- is not found or the variable is not
- set, English is used.
-
- Currently you can select one of these:
- suomi (Finnish)
- français (French)
- dansk (Danish)
- español (Spanish)
- svenska (Swedish)
- Or use the default English.
-
- cwd current working directory
- quota disk space currently used (in kB)
-
- lasterr return code from the last command
- ioerr IoErr() returned by the last external command
- Lasterr and ioerr are not seen in the variable list.
-
- term terminal emulation (vt100 or ansi, def:ansi)
- rows number of rows on terminal (default: 24)
- visual name of the full screen editor (def: editor)
- edscroll scroll length in lines (in editor)
- prompt the prompt format:
- Variables:
- %% % itself
- %d current working directory
- %h command counter
- %l line (terminal)
- %M hostname
- %q actual quota/limit
- %r full name
- %t time (full time now, might change)
- %u username
- %i intime (in minutes)
-
- C-style special codes:
- \e ESC
- \t TAB
- \n Newline
- \r CR
- \a BEL
-
- Control codes:
- ^L Ctrl-l
- ^G Ctrl-g
- etc..
-
- any other character as is, default prompt
- is "%h.%d> "
- Example:
- set prompt "\\e[1m(%u)\\e[m %%%h \\e[7m%d\\e[m > "
-
- Notice that you have to double the backslashes,
- because they have precedence over doublequotes.
-
- ignoreeof
- if this variable is set, ^D will do exit..
- It is actually reversed from the tcsh.
-
- HELP You can create macros by defining these
- F1 variables. e.g.
- .. set F1 "^a^d^d^d^drm^e"
- F20 will goto start of line, delete 4 chars, add
- "rm" and goto end of line when you press F1.
- C-style codes and control characters are like in
- the prompt.
-
- -- Special variables in scripts --
-
- argument Works only with a word specifier, not as $argument.
- argument[0] is 'execute', argument[1] is the
- script name (possibly including path) etc.
- This variable is not seen in the variable list.
-
- sysinfo Print out some information about the OS version etc.
-
- unalias word [word2 .. [wordn]]
- Discard one or more aliases.
-
- unset var [var2 .. [varn] ]
- Discard one or more shell variables.
-
- upload file [file2 ..]
- Copies the file(s) to the system upload directory.
-
- uptime Displays uptime and system load information.
-
- wait time
- Goto sleep for time (in seconds). Wait can be stopped
- with a keypress.
-
- which command
- Will show from where the command is executed. e.g.
-
- %14 (root) AXsh:home/root/ 169 > which dir
- AXsh ALIAS
- DH0:Oldsys/C/Dir
- c:dir
-
- Dir is an alias, but otherwise DH0:oldsys/c/dir would
- have been executed. There is also another dir in the
- command search path, c:dir.
-
- who Displays uptime and load information with a list of the
- users currently logged in.
-
- whoami Print out your current login name
-
- write user text [text ..]
- Will send the text to another user in the system.
- If the user is not logged in, an error message is
- displayed instead.
-
- Special script file commands
-
- The if-construct is a bit lame, but there simply are some
- more important features to think about..
-
- if Keywords for if-else-endif -contruct.
- else The condition can be one of the forms :
- endif "foo" == "foo"
- "bar" != "foobar"
- exists file
-
- If you use variable, the form depends on the variable
- $var != "foo" will become:
- "" != "foo" , if the variable is empty and
- var != "foo" , if the variable is unset
-
- goto label
- Jumps to a defined label. It is an error if the label
- doesn't exist.
-
- quit Exits the script
-
- label: [command]
- Command labeling . The command is optional, and the
- label is ignored in the command execution. A label
- name cannot have spaces in it.
-
- ; comment
- Commenting. Starts a comment which proceeds to the
- next end-of-line.
-
- FILES
- /bin/AXsh AXsh executable
- /etc/rc Configuration file
- /etc/ForbiddenVars File holding all untouchable variables:
- <varname> [<number of sets allowed>]
- /etc/GlobalLogin Script executed at login, can be used to
- set system variables like POSTNEWS etc.
- Still executed with user's privileges.
- ~/.lastlogin Showed by the login shell at login.
- ~/.logout Script which is EXECUTEd at logout
- ~/.login Script which is EXECUTEd at login
-
- SEE ALSO
- login, exit, cd, execute
-
-